package com.accp.vehiclecare.dao.hzdao;

import com.accp.vehiclecare.vo.hzvo.Vehicletype;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface VehicletypeMapper {
    int deleteByPrimaryKey(Integer vtypeid);

    int insert(Vehicletype record);

    int insertSelective(Vehicletype record);

    Vehicletype selectByPrimaryKey(Integer vtypeid);

    int updateByPrimaryKeySelective(Vehicletype record);

    int updateByPrimaryKey(Vehicletype record);


    @Insert("INSERT INTO`vehicletype`(`enginetypeid`,`vtypeno`,`vtypename`,`vprice`,`vdate`,`vpower`,`fuelmark`)\n" +
            "VALUES(#{vehicletype.enginetypeid},#{vehicletype.vtypeno},#{vehicletype.vtypename},#{vehicletype.vprice},#{vehicletype.vdate}," +
            "#{vehicletype.vpower},#{vehicletype.fuelmark})")
    int addcx(@Param("vehicletype")Vehicletype vehicletype);

    List<Vehicletype>listshow(@Param("name")String name);

    @Select("SELECT * FROM `vehicletype`\n" +
            "LEFT JOIN `enginetype` ON (`enginetype`.`enginetypeid`=`vehicletype`.`enginetypeid`) WHERE `vtypeid`=#{id}")
    Vehicletype selectone(@Param("id") Integer id);
    @Update("UPDATE `vehicletype` " +
            "SET `enginetypeid`=#{vehicletype.enginetypeid},`vtypeno`=#{vehicletype.vtypeno}," +
            "`vtypename`=#{vehicletype.vtypename},`vprice`=#{vehicletype.vprice},`vdate`=#{vehicletype.vdate},`vpower`=#{vehicletype.vpower}," +
            "`fuelmark`=#{vehicletype.fuelmark} WHERE `vtypeid`=#{id}\n")
    int updateVehicletype(@Param("vehicletype")Vehicletype vehicletype,@Param("id") Integer id);

    @Delete("DELETE FROM `vehicletype` WHERE `vtypeid`=#{id}")
    int removeVehicletype(@Param("id")Integer id);
}